package com.kaoshi.myweb.webtest.java.nio;

import java.nio.ByteBuffer;
import java.nio.FloatBuffer;

public class UseFloatBuffer {

	public static void main(String[] args) {
		FloatBuffer floatBuffer = FloatBuffer.allocate(10);
		for (int i = 0; i < floatBuffer.capacity(); i++) {
			float f = (float) Math.sin((((float)i)/10)*(2*Math.PI));
			floatBuffer.put(f);
		}
		
		floatBuffer.flip();
		
		while (floatBuffer.hasRemaining()) {
			float f = floatBuffer.get();
			System.out.println(f);
		}
	}

}
